<?php

namespace App\Models;

use App\Http\Controllers\Admin\Finance\RecBill;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model as BaseModel;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;

class RecBillTicketModel extends BaseModel
{
    use HasFactory;

    protected $table = 't_rec_bill_ticket';

    protected $primaryKey = 'id';

    public $timestamps = true;

    const CREATED_AT = 'created_at';
    
    const UPDATED_AT = null;

    protected $guarded = [];

    protected $hidden = [
    ];

    //类型 1开票 2收款
    const TYPE_MAPS = [
        1 => '开票',
        2 => '收款',
    ];

    //创建人
    public function create_admin(): BelongsTo {
        return $this->belongsTo(AdminModel::class, 'created_admin_id');
    }

    //账单
    public function rec_bill(): BelongsTo {
        return $this->belongsTo(RecBillModel::class, 'rec_bill_id');
    }

}
